import server from '../server/http'

// 请求首页banner数据
const getBanners = async function () {
    var res = await server.get('/small4/banner/list')
    return Promise.resolve(res.config.headers.token)
}
// 登录借口
const getlogin = async function (params) {

    var res = await server({
        url: '/small4/user/m/login?deviceId=007&deviceName=monkey',
        method: "post",
        params
    })

    return Promise.resolve(res)

}
//  轮播图借口
const getlun = async function () {
    var res = await server.get('/small4/banner/list')
    return Promise.resolve(res.data.data)
}
// 砍价借口
const getshop = async function () {
    var res = await server.get('/small4/shop/goods/kanjia/list')
    return Promise.resolve(res.data.data.goodsMap)
}
// 精选专题
const getjingxuan = async function () {
    var res = await server.get('/small4/cms/news/list')
    return Promise.resolve(res.data.data)
}
// 领劵借口
const getlingjuan = async function () {
    var res = await server.post('/small4/discounts/coupons')
    return Promise.resolve(res.data.data)
}
// 分类借口
const getfenlei = async function () {
    var res = await server.post('/small4/shop/goods/category/all')
    return Promise.resolve(res.data.data)
}

// 分类的子接口
const getfenlei1 = async function () {
    var res = await server.get('/small4/shop/goods/list')
    return Promise.resolve(res.data.data)
}

// 购物车接口
const getgouwu = async function (params) {
    var res = await server({ url: '/small4/shop/goods/list', method: 'get', params })

    return Promise.resolve(res.data.data)
}
// 购物详情接口
const getgouwuxiangqing = async function (params) {
    var res = await server({
        url: '/small4/shop/goods/detail', method: 'post', params: {
            id: params
        }
    })

    return Promise.resolve(res)
}
// 专栏详情接口
const getzhuanlanxiangqing = async function (params) {
    var res = await server({
        url: 'small4/cms/news/detail', method: 'get', params: {
            id: params
        }
    })
    return Promise.resolve(res)
}
// 评价接口
const getpingjia = async function (params) {
    let res = await server({
        url: "small4/shop/goods/reputation",
        method: 'post', params
    })
   return Promise.resolve(res)
}

// 购买接口
const getgoumaijiekou = async function (params) {
    let res = await server({
        url: "/small4/shop/goods/price",
        method: 'post', params
    })
   return Promise.resolve(res)
}
// 签到接口
const getqiandao = async function () {
    var res = await server.post('/small4/score/sign')
    return Promise.resolve(res)
}

export {
    getBanners,
    getlogin,
    getlun,
    getshop,
    getjingxuan,
    getlingjuan,
    getfenlei,
    getfenlei1,
    getgouwu,
    getgouwuxiangqing,
    getzhuanlanxiangqing,
    getpingjia,
    getgoumaijiekou,
    getqiandao
}